An electronic device such as a microcontroller may be applied in a context where it is critical that data stored in its memory is correctly stored. Therefore, the electronic device may be configured to periodically perform a test of its memory according to a test method. Test methods should usually be able to detect a wide range of errors, i.e. test coverage should be good. Further, it may be desirable that the test is non-destructive, i.e. that data stored before the test in the memory is not destroyed by the test.